function add_advertising(){
	jQuery.post(BASE_URI+'admin/dataman/advertising/add',{},function(res){
		jQuery('#dialog').html(res);
		jQuery('#dialog').dialog(
			{
				 width: 650,
				 resizable: false,
				 height:350,
				 title: 'Add Advertising' 
			}
		);
	});
}

function adv_edit(id){
	jQuery.post(BASE_URI+'admin/dataman/advertising/edit',{id:id},function(res){
		jQuery('#dialog').html(res);
		jQuery('#dialog').dialog(
			{
				 width: 650,
				 resizable: false,
				 height:350,
				 title: 'Edit Advertising' 
			}
		);
	});
}

function adv_delete(id){
	jQuery.post(BASE_URI+'admin/dataman/advertising/delete',{id:id},function(res){
		reload();
	});
}

function adv_status(id){
	jQuery.post(BASE_URI+'admin/dataman/advertising/change_status',{id:id},function(res){
		reload();
	});
}

jQuery(document).ready(function() {
	
	var options = { 
		beforeSubmit:function(formData, jqForm, options){ 
			return true;
		},   
		success:function(responseText, statusText, xhr, $form){
			if(responseText == 'ok'){
				reload();
			}else{
				alert(responseText);
			}
		}   
	};	
	
	jQuery("#add_edit_submit").live("submit",function(e){
		e.preventDefault(); // <-- important
		jQuery(this).ajaxSubmit(options);
		return false;
	});		
	
});
 